package com.tanhua.server;

import com.tanhua.commons.template.OssTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.*;

@SpringBootTest
@RunWith(SpringRunner.class)
public class TanHuaTestOss {
    @Autowired
    private OssTemplate ossTemplate;

    @Test
    public void testUpload() throws IOException {
        File file;
        InputStream is = new FileInputStream("C:\\Users\\MJY\\Desktop\\timg.jpg");
        String url = ossTemplate.upload("timg.jpg", is);
        System.out.println(url);
        is.close();
    }

}
